<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    var obj = {
        name:"admin",
        age:18,
        sex:"男",
        show:function(){
            console.log(obj.name, obj.age)
        },
        hobby:["篮球","足球","乒乓球","排球","羽毛球"],
        children:[{
            name:"张三",
            age:3
        },{
            name:"张四",
            age:1
        }]
    };

    // console.log(obj.length)
    // console.log(obj[0])

    // for(var i=0;i<obj.length;i++){
    //     console.log(i);
    //     console.log(obj[i]);
    // }

    // for-in语句：专门用来枚举（遍历）object对象（非array对象）
    // for(var i in obj){
    //     console.log(i, obj[i]);
    // }

    // =======

    // var keys = Object.keys( obj );

    // console.log(keys);
    // console.log(keys.length);
    // console.log( keys[2] );
    // console.log( obj[keys[2]] );

    // for(var i=0;i<keys.length;i++){
    //     console.log(keys[i], obj[keys[i]]);
    // }

    var values = Object.values( obj );
    console.log(values);


    
</script>
</html>